import axios from "@/utils/axios";
//加密算法
// import { shaCrypto } from '../utils/crypto';
import { pubKeyBase64 } from "@/constants";
import JSEncrypt from "jsencrypt";
export const getUsersList = (parmas) => {
  return axios.get("/um/user/list", parmas);
};
export const addUsers = (body) => {
  const encryptor = new JSEncrypt(); // 创建加密对象实例
  const pubKey = window.atob(pubKeyBase64);
  encryptor.setPublicKey(pubKey);
  const rsaPassWord = encryptor.encrypt(body["pwd"]);
  body["pwd"] = rsaPassWord;
  return axios.post("/um/user/create", body);
};
export const editPassWord = (body) => {
  const encryptor = new JSEncrypt(); // 创建加密对象实例
  const pubKey = window.atob(pubKeyBase64);
  encryptor.setPublicKey(pubKey);
  const rsaPassWord = encryptor.encrypt(body["pwd"]);
  body["pwd"] = rsaPassWord;
  return axios.put(`/um/user/${body["id"]}`, { pwd: body["pwd"] });
};
